<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/7/23
 * Time: 18:57
 */
namespace app\api\validate;
use app\common\validate\Base;

class Partner extends Base
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'              => 'require',
        'phone'             => 'require|max:11|/^1[3-8]{1}[0-9]{9}$/|unique:firm_partner',
        'address'           => 'require',
        'partner_demand'    => 'require',
     ];

    /**
     * 提示消息
     */
    protected $message = [
        'phone.unique' => '该联系方式已存在或您已经提交过需求'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add' => ['name','phone','address','partner_demand']
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'name'             => __('Name'),
            'phone'            => __('Phone'),
            'address'          => __('Address'),
            'partner_demand'   => __('Partner demand')
        ];
        parent::__construct($rules, $message, $field);
    }
}